#ifndef CHILD_H
#define CHILD_H

#include <QTextEdit>
#include<QCloseEvent>
class child : public QTextEdit
{
    Q_OBJECT
public:
    child();

    void newFile();//新建文件
    bool loadFile(const QString &fileName);//导入本地文件
    bool save();//保存文件
    bool saveAs();//另存为
    bool saveFile(QString fileName);
    QString userFriendlyCurrentfile();//
    QString currentFile(){ return curFile;}
    void mergeFormationOnWordOrSelection(const QTextCharFormat &format);//格式字体设置
    void setAlign(int align);
    void setStyle(int style);

protected:
    void closeEvent(QCloseEvent *event);

private slots:
    void documentWasModified();

private:
    QString curFile;
    bool isUntitled;

    bool maybeSave();
    void setCurrentFile(const QString &fileName);
    QString strippedName(const QString &fullFileName);

};

#endif // CHILD_H
